function faceIndex = CalcFace(mesh,type)

% nDim : the number of dimension of grid,such as 2D or 3D.
nDim = mesh.nDim;

if(type == 0)
    % Unstruct grid.
    faceIndex = CalcUnstructFace(mesh);
elseif(type == 1)
    % Struct grid.
    if(nDim == 2)
        faceIndex = CalcStruct2DFace(mesh);
    elseif(nDim ==3)
        faceIndex = CalcStruct3DFace(mesh);
    end
end